<?php

/**
 * Paciente filter form base class.
 *
 * @package    asindo
 * @subpackage filter
 * @author     Ignacio Calvo
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BasePacienteFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'sociedad_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Sociedad'), 'add_empty' => true)),
      'pediatra_habitual_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Pediatra'), 'add_empty' => true)),
      'nombre'               => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'apellido1'            => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'apellido2'            => new sfWidgetFormFilterInput(),
      'fecha_nacimiento'     => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'orden_hermanos'       => new sfWidgetFormFilterInput(),
      'sexo'                 => new sfWidgetFormFilterInput(),
      'alarmas'              => new sfWidgetFormFilterInput(),
      'fecha_alta'           => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'tipo_via'             => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'via'                  => new sfWidgetFormFilterInput(),
      'cp'                   => new sfWidgetFormFilterInput(),
      'numero'               => new sfWidgetFormFilterInput(),
      'piso'                 => new sfWidgetFormFilterInput(),
      'letra'                => new sfWidgetFormFilterInput(),
      'poblacion'            => new sfWidgetFormFilterInput(),
      'provincia'            => new sfWidgetFormFilterInput(),
      'email'                => new sfWidgetFormFilterInput(),
      'telefono1'            => new sfWidgetFormFilterInput(),
      'telefono2'            => new sfWidgetFormFilterInput(),
      'telefono3'            => new sfWidgetFormFilterInput(),
      'observaciones'        => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'sociedad_id'          => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Sociedad'), 'column' => 'id')),
      'pediatra_habitual_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Pediatra'), 'column' => 'id')),
      'nombre'               => new sfValidatorPass(array('required' => false)),
      'apellido1'            => new sfValidatorPass(array('required' => false)),
      'apellido2'            => new sfValidatorPass(array('required' => false)),
      'fecha_nacimiento'     => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'orden_hermanos'       => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'sexo'                 => new sfValidatorPass(array('required' => false)),
      'alarmas'              => new sfValidatorPass(array('required' => false)),
      'fecha_alta'           => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'tipo_via'             => new sfValidatorPass(array('required' => false)),
      'via'                  => new sfValidatorPass(array('required' => false)),
      'cp'                   => new sfValidatorPass(array('required' => false)),
      'numero'               => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'piso'                 => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'letra'                => new sfValidatorPass(array('required' => false)),
      'poblacion'            => new sfValidatorPass(array('required' => false)),
      'provincia'            => new sfValidatorPass(array('required' => false)),
      'email'                => new sfValidatorPass(array('required' => false)),
      'telefono1'            => new sfValidatorPass(array('required' => false)),
      'telefono2'            => new sfValidatorPass(array('required' => false)),
      'telefono3'            => new sfValidatorPass(array('required' => false)),
      'observaciones'        => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('paciente_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Paciente';
  }

  public function getFields()
  {
    return array(
      'id'                   => 'Number',
      'sociedad_id'          => 'ForeignKey',
      'pediatra_habitual_id' => 'ForeignKey',
      'nombre'               => 'Text',
      'apellido1'            => 'Text',
      'apellido2'            => 'Text',
      'fecha_nacimiento'     => 'Date',
      'orden_hermanos'       => 'Number',
      'sexo'                 => 'Text',
      'alarmas'              => 'Text',
      'fecha_alta'           => 'Date',
      'tipo_via'             => 'Text',
      'via'                  => 'Text',
      'cp'                   => 'Text',
      'numero'               => 'Number',
      'piso'                 => 'Number',
      'letra'                => 'Text',
      'poblacion'            => 'Text',
      'provincia'            => 'Text',
      'email'                => 'Text',
      'telefono1'            => 'Text',
      'telefono2'            => 'Text',
      'telefono3'            => 'Text',
      'observaciones'        => 'Text',
    );
  }
}
